import { IsString, IsOptional, IsBoolean, IsNumber, IsObject } from 'class-validator'
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'

export class CreateCategoryDto {
  @ApiProperty({ description: '分类名称' })
  @IsString()
  name: string

  @ApiProperty({ description: '分类别名' })
  @IsString()
  slug: string

  @ApiPropertyOptional({ description: '分类描述' })
  @IsOptional()
  @IsString()
  description?: string

  @ApiPropertyOptional({ description: '父分类ID' })
  @IsOptional()
  @IsString()
  parentId?: string

  @ApiPropertyOptional({ description: '是否激活', default: true })
  @IsOptional()
  @IsBoolean()
  isActive?: boolean

  @ApiPropertyOptional({ description: '排序顺序', default: 0 })
  @IsOptional()
  @IsNumber()
  sortOrder?: number

  @ApiPropertyOptional({ description: '元数据' })
  @IsOptional()
  @IsObject()
  metadata?: Record<string, any>
}
